<!--
 * @Author: Christion.Young
 * @Date: 2020-11-26 21:21:58
 * @LastEditors: zhangjingyu
 * @LastEditTime: 2021-01-04 13:42:17
 * @FilePath: \vprisk10.14\src\views\PublicManage\publicManage\financialInstrument\financialITDefinition\financialITDefinition.vue
 * @Description: 金融工具表定义
-->

<!-- 金融工具表定义 -->
<template>
  <div class="dataAssociationVC">
    <el-row>
      <el-col>
        <!-- 操作区域 -->
        <upper-template @search="queryBtn" @clear="resetBtn">
          <!-- 操作按钮区 -->
          <div slot="buttonArea">
            <el-button @click="addFunc">新增</el-button>
            <el-button @click="editFunc">编辑</el-button>
            <el-button @click="delFunc">删除</el-button>
            <el-button @click="issueFunc">发布</el-button>
            <el-button @click="blockUpFunc">停用</el-button>
            <el-button @click="checkFunc">查看</el-button>
          </div>
          <!-- 搜索区 -->
          <div slot="searchArea">
            <el-form
              :model="searchForm"
              ref="searchForm"
              label-width="100px"
              label-position="left"
              size="mini"
              style="margin-left: -15px;"
            >
              <el-form-item label="表中文名称：">
                <el-input
                  v-model="searchForm.tableNameCn"
                  placeholder="请输入表中文名称"
                ></el-input>
              </el-form-item>
              <el-form-item label="表英文名称：">
                <el-input
                  v-model="searchForm.tableNameEn"
                  placeholder="请输入表英文名称"
                ></el-input>
              </el-form-item>
            </el-form>
          </div>
          <!-- 显示隐藏区 -->
          <div slot="columnHide">
            <el-checkbox-group v-model="checkList">
              <el-checkbox
                v-for="item in textData"
                :label="item.label"
                :key="item.prop"
                >{{ item.label }}
              </el-checkbox>
            </el-checkbox-group>
          </div>
        </upper-template>

        <!-- 列表 -->
        <el-table
          ref="multipleTable"
          :data="tableData"
          stripe
          @row-click="authorizeFor"
        >
          <el-table-column
            width="55"
            type="selection"
            
          ></el-table-column>
          <el-table-column
            prop="tableNameCn"
            label="表中文名称"
            v-if="columnState[0]"
             show-overflow-tooltip 
          >
          </el-table-column>
          <el-table-column
            prop="tableNameEn"
            label="表英文名称"
             show-overflow-tooltip 
            :formatter="row => row.tableNameEnPrefix + row.tableNameEn"
            v-if="columnState[1]"
          >
          </el-table-column>
          <el-table-column
            prop="moduleCode"
            label="所属模块"
            v-if="columnState[2]"
            :formatter="row=>$getLabel(row.moduleCode,moduleCodeOption)"
          >
          </el-table-column>
          <el-table-column
            prop="tableType"
            label="工具表模板"
             show-overflow-tooltip 
            :formatter="
              row =>
                row.tableType
                  ? $getLabel(
                      row.tableType,
                      fTTCHList,
                      'tableCode',
                      'tableNameCn'
                    )
                  : '-'
            "
            v-if="columnState[3]"
          >
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态"
            :formatter="statusFormatter"
            v-if="columnState[4]"
          >
          </el-table-column>
          <el-table-column
            prop="descn"
            label="描述"
             show-overflow-tooltip 
            :formatter="row => row.descn || '-'"
            v-if="columnState[5]"
          >
          </el-table-column>
          <el-table-column
            prop="creator"
            label="创建人"
            show-overflow-tooltip 
            :formatter="row => row.creator || '-'"
            v-if="columnState[6]"
          >
          </el-table-column>
          <el-table-column
            prop="createdTm"
            label="创建时间"
            :formatter="
              row => (row.createdTm ? setCalendarDate(row.createdTm) : '-')
            "
             show-overflow-tooltip 
            v-if="columnState[7]"
          >
          </el-table-column>
          <el-table-column
            prop="modifier"
            label="修改人"
            :formatter="row => row.modifier || '-'"
            v-if="columnState[8]"
             show-overflow-tooltip 
          >
          </el-table-column>
          <el-table-column
            prop="modifiedTm"
            label="修改时间"
            :formatter="
              row => (row.modifiedTm ? setCalendarDate(row.modifiedTm) : '-')
            "
            v-if="columnState[9]"
             show-overflow-tooltip 
          >
          </el-table-column>
        </el-table>
        <!-- 分页 -->
        <pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          @refresh="searchFunc"
          :current-page="searchForm.page"
          :page-size="searchForm.size"
          :total="total"
        ></pagination>
      </el-col>
    </el-row>

    <!--   新增/编辑    ############################################################################################################################ -->
    <el-dialog
      v-dialogDrag
      :title="saveTitles[saveFlg - 1]"
      :visible.sync="addOrEdit"
      width="550px"
      top="5%"
    >
      <el-form
        :model="saveForm"
        ref="addTreeForm"
        label-width="150px"
        label-position="right"
        :rules="saveFormRules"
      >
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="所属模块："
              style="width:500px;"
              prop="moduleCode"
            >
              <el-select
                v-model="saveForm.moduleCode"
                placeholder="请选择"
                @change="moduleChange"
                style="width:297px;"
              >
                <el-option
                  v-for="item in moduleCodeOption"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item
              label="金融工具表模板："
              style="width:500px;"
              prop="tableType"
            >
              <el-select
                v-model="saveForm.tableType"
                placeholder="请选择"
                style="width:200px;"
                clearable
                @change="tableTypeChange"
              >
                <el-option
                  v-for="item in fTTQueryList"
                  :key="item.tableCode"
                  :label="item.tableNameCn"
                  :value="item.tableCode"
                ></el-option>
              </el-select>
              <el-button
                icon="el-icon-plus"
                style="padding: 10px 10px 9px; margin-left: 10px;"
                @click="seeTemplateBtn()"
                >查看模板</el-button
              >
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item
              label="表英文名称："
              style="width:500px;"
              prop="tableNameEnPrefix"
            >
              <el-form-item
                prop="tableNameEnPrefix"
                style="display: inline-block;"
              >
                <el-input
                  v-model="saveForm.tableNameEnPrefix"
                  disabled
                  style="width:140px;"
                ></el-input>
              </el-form-item>

              <span style="padding: 6px;">-</span>
              <el-form-item prop="tableNameEn" style="display: inline-block;">
                <el-input
                  v-model="saveForm.tableNameEn"
                  style="width:140px;"
                ></el-input>
              </el-form-item>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item
              label="表中文名称："
              style="width:500px;"
              prop="tableNameCn"
            >
              <el-input
                v-model="saveForm.tableNameCn"
                style="width:297px;"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item label="状态：" style="width:500px;" prop="status">
              <el-select
                v-model="saveForm.status"
                placeholder="请选择"
                style="width:297px;"
                disabled
              >
                <el-option
                  v-for="item in statusOption"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="描述：" style="width:500px;" prop="descn">
              <el-input
                v-model="saveForm.descn"
                style="width:297px;"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer">
        <el-button @click="confirmTne">确 定</el-button>
        <el-button @click="cancelTne">取 消</el-button>
      </div>
    </el-dialog>

    <!--   查看         ############################################################################################################################ -->
    <el-dialog
      v-dialogDrag
      title="查看"
      :visible.sync="seeDialog"
      width="700px"
      top="5%"
    >
      <el-tabs v-model="activeName">
        <el-tab-pane label="基本信息" name="essInfo">
          <el-form
            :model="saveForm"
            ref="addTreeFormSee"
            label-width="200px"
            label-position="right"
            style="margin-bottom:20px;"
            :rules="saveFormRules"
          >
            <el-row>
              <el-col :span="24">
                <el-form-item
                  label="金融工具表模板："
                  style="width:500px;"
                  prop="tableType"
                >
                  <el-select
                    v-model="saveForm.tableType"
                    placeholder="请选择"
                    style="width:200px;"
                    disabled
                    clearable
                    @change="tableTypeChange"
                  >
                    <el-option
                      v-for="item in fTTQueryList"
                      :key="item.tableCode"
                      :label="item.tableNameCn"
                      :value="item.tableCode"
                    ></el-option>
                  </el-select>
                  <el-button
                    icon="el-icon-plus"
                    style="padding: 10px 10px 9px; margin-left: 10px;"
                    @click="seeTemplateBtn()"
                    >查看模板</el-button
                  >
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="表英文名称：" style="width:500px;">
                  <el-form-item
                    prop="tableNameEnPrefix"
                    style="display: inline-block;"
                  >
                    <el-input
                      v-model="saveForm.tableNameEnPrefix"
                      disabled
                      style="width:140px;"
                    ></el-input>
                  </el-form-item>
                  <span style="padding: 6px;">-</span>
                  <el-form-item
                    prop="tableNameEn"
                    style="display: inline-block;"
                  >
                    <el-input
                      v-model="saveForm.tableNameEn"
                      disabled
                      style="width:140px;"
                    ></el-input>
                  </el-form-item>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item
                  label="表中文名称："
                  style="width:500px;"
                  prop="tableNameCn"
                >
                  <el-input
                    v-model="saveForm.tableNameCn"
                    style="width:297px;"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item
                  label="所属模块："
                  style="width:500px;"
                  prop="moduleCode"
                >
                  <el-input
                    v-model="saveForm.moduleCode"
                    style="width:297px;"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="状态：" style="width:500px;" prop="status">
                  <el-select
                    v-model="saveForm.status"
                    placeholder="请选择"
                    style="width:297px;"
                    disabled
                  >
                    <el-option
                      v-for="item in statusOption"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="描述：" style="width:500px;" prop="descn">
                  <el-input
                    v-model="saveForm.descn"
                    style="width:297px;"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="字段信息" name="fieldInfo">
          <FieldInformationCom
            ref="FieldInformationComFieldInfo"
            :required-parameter="requiredParameterFieldInfo"
          />
        </el-tab-pane>
      </el-tabs>
    </el-dialog>

    <!--   查看模板     ############################################################################################################################ -->
    <el-dialog
      v-dialogDrag
      title="查看模板"
      :visible.sync="seeTemplate"
      width="700px"
      top="5%"
    >
      <div>
        <FieldInformationCom
          ref="FieldInformationCom"
          :required-parameter="requiredParameter"
        />
      </div>
    </el-dialog>
  </div>
</template>

<script>
import FieldInformationCom from "./fieldInformationCom";
import { publicManage_dat } from "@/api/index";
import moment from "moment";
export default {
  components: {
    FieldInformationCom
  },
  data() {
    return {
      checkList: [
        "表中文名称",
        "表英文名称",
        "所属模块",
        "工具表模板",
        "状态",
        "描述",
        "创建人",
        "创建时间",
        "修改人",
        "修改时间"
      ],
      fTTCHList: [],
      textData: [
        { prop: "tableNameCn", label: "表中文名称" },
        { prop: "tableNameEn", label: "表英文名称" },
        { prop: "moduleCode", label: "所属模块" },
        { prop: "tableType", label: "工具表模板" },
        { prop: "status", label: "状态" },
        { prop: "descn", label: "描述" },
        { prop: "creator", label: "创建人" },
        { prop: "createdTm", label: "创建时间" },
        { prop: "modifier", label: "修改人" },
        { prop: "modifiedTm", label: "修改时间" }
      ],
      activeName: "essInfo",
      tableData: [],
      searchForm: {
        tableNameEn: "",
        tableNameCn: "",
        isModule: "0",
        page: 1,
        size: 15
      },
      total: 0,
      fTTQueryList: [],
      //   新增/编辑   ##########################################################################################################################################
      addOrEdit: false,
      saveFlg: 1,
      saveTitles: ["新增模板", "编辑模板"],
      saveForm: {
        tableType: "",
        tableNameEnPrefix: "",
        tableNameEn: "",
        tableNameCn: "",
        moduleCode: "",
        status: "",
        descn: "",
        isModule: "0"
      },
      saveFormRules: {
        tableType: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur"
          }
        ],
        tableNameEn: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur"
          },
          {
            pattern: /^[A-Z0-9_]{1,40}$/,
            message: "只能输入大写英文字母、数字和下划线",
            trigger: "blur"
          },
          {
            validator: this.validatorFTTCheckTableNameEn,
            trigger: "blur"
          }
        ],
        tableNameCn: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur"
          },
          {
            pattern: /^[\u4E00-\u9FA5]{1,20}$/,
            message: "只能输入1-20位的汉字",
            trigger: "blur"
          },
          {
            validator: this.validatorFTTCheckTableNameCn,
            trigger: "blur"
          }
        ],
        moduleCode: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur"
          }
        ],
        status: [
          {
            required: true,
            message: "该输入项为必输项",
            trigger: "blur"
          }
        ]
      },
      //   查看        ##########################################################################################################################################
      seeDialog: false,
      //   查看模板    ##########################################################################################################################################
      seeTemplate: false,
      requiredParameter: "",
      requiredParameterFieldInfo: "",
      moduleCodeOption: [],
      statusOption: [
        { name: "未发布", code: "1" },
        { name: "已发布", code: "2" },
        { name: "已停用", code: "3" }
      ]
    };
  },
  created() {},
  computed: {
    columnState() {
      let arr = [],
        arr1 = this.textData,
        arr2 = this.checkList;
      for (let i = 0; i < arr1.length; i++) {
        let flg = false;
        for (let j = 0; j < arr2.length; j++) {
          if (arr1[i].label === arr2[j]) {
            flg = true;
          }
        }
        arr.push(flg);
      }
      return arr;
    }
  },
  mounted() {
    this.getDict()
    this.$nextTick(()=>{
      this.searchFunc();
      this.getFundQueryModelList();
    })
  },
  watch: {
    addOrEdit() {
      // 窗口打开或关闭清除校验结果
      if (this.$refs.addTreeForm) {
        this.$refs.addTreeForm.clearValidate();
      }
    }
  },
  methods: {
    getDict(){
            this.$getDict('cpm_moduleCode').then(res=>{
                if(res.code==200){
                    this.moduleCodeOption = res.datas
                }
            })
        },
    //表单数据处理
    gettableCode(val) {
      let arr = [];
      arr = this.fTTQueryList.filter(item => {
        return (val.tableCode = item.tableCode);
      });
      if (arr.length == 0) {
        return "暂无数据";
      } else {
        return arr[0].tableNameCn;
      }
    },
    //获取金融工具表模板下拉列表
    getFundQueryList(data) {
      publicManage_dat.fundToolTableQueryList(data).then(res => {
        if (res.code === 200) {
          this.fTTQueryList = res.datas;
        } else {
          this.$message.error(res.message);
        }
      });
    },
    //获取金融工具表模板列表供表格翻译
    getFundQueryModelList() {
      publicManage_dat.fundToolTableQueryList().then(res => {
        if (res.code === 200) {
          this.fTTCHList = res.datas;
        } else {
          this.$message.error(res.message);
        }
      });
    },
    //新增
    addFunc() {
      this.saveFlg = 1;
      for (let k in this.saveForm) {
        this.saveForm[k] = "";
      }
      this.saveForm.status = "1";
      this.addOrEdit = true;
    },
    //编辑
    editFunc() {
      this.saveFlg = 2;
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行修改");
      }
      if (selection[0].status === "2") {
        return this.$message.warning("已发布的数据不可编辑");
      }
      this.moduleChange(selection[0].moduleCode);
      this.$nextTick(() => {
        this.saveForm.tableType = selection[0].tableType;
      });
      this.saveForm = JSON.parse(JSON.stringify(selection[0]));
      this.addOrEdit = true;
    },
    //删除
    delFunc() {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length < 1) {
        return this.$message.warning("请选择要删除的数据");
      }
      let isStatus = false;
      selection.forEach(element => {
        if (element.status === "2" || element.status === "3") {
          isStatus = true;
        }
      });
      if (isStatus) {
        return this.$message.warning("已发布（已停用）的数据不可删除");
      }
      this.$confirm("您确定要删除选中数据吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          const paramData = [];
          selection.forEach(element => {
            paramData.push(element.tableId);
          });
          publicManage_dat.fundToolTableRemove({ ids: paramData }).then(res => {
            this.$message({
              message: res.message,
              type: "success"
            });
            this.searchFunc();
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    //发布
    issueFunc() {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据");
      }
      const paramData = [];
      selection.forEach(element => {
        if (element.status === "3") {
          return this.$message.warning("已停用数据不能发布");
        } else if (element.status === "2") {
          return this.$message.warning("已发布状态数据不能发布");
        } else {
          paramData.push(element.tableId);
          publicManage_dat
            .fundToolTableToPublish({
              tableId: selection[0].tableId
            })
            .then((res) => {
             if (res.code == 200) {
                this.$message({
                  message: "发布成功",
                  type: "success",
                });
                this.searchFunc();
              } else {
                return this.$message.error(res.message || '失败')
              }
            });
        }
      });
    },
    //停用
    blockUpFunc() {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据");
      }
      const paramData = [];
      selection.forEach(element => {
        paramData.push(element.tableId);
      });
      publicManage_dat
        .fundToolTableToStop({
          tableId: selection[0].tableId
        })
        .then(() => {
          this.$message({
            message: "停用成功",
            type: "success"
          });
          this.searchFunc();
        });
    },
    //查看
    checkFunc() {
      this.saveFlg = 2;
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行查看");
      }
      let row = selection[0];
      this.requiredParameterFieldInfo = selection[0].tableId;
      let form = { ...row };
      this.saveForm = form;
      this.getFundQueryList({ moduleCode: this.saveForm.moduleCode });
      this.seeDialog = true;
      this.$nextTick(() => {
        this.$refs.FieldInformationComFieldInfo.saveForm.columnEn = "";
        this.$refs.FieldInformationComFieldInfo.saveForm.columnCn = "";
        this.$refs.FieldInformationComFieldInfo.saveForm.columnType = "";
        this.$refs.FieldInformationComFieldInfo.searchFunc();
      });
    },
    //查询
    queryBtn() {
      this.searchForm.page = 1;
      this.searchFunc();
    },
    //重置
    resetBtn() {
      this.searchForm = {
        tableNameEn: "",
        tableNameCn: "",
        isModule: "0",
        page: 1,
        size: 15
      };
    },
    //   新增/编辑   ##########################################################################################################################################
    //确定
    confirmTne() {
      this.$refs.addTreeForm.validate(valid => {
        if (valid) {
          this.saveForm.isModule = "0";
          publicManage_dat.fundToolTableSave(this.saveForm).then(res => {
            if (res.code === 200) {
              this.$message.success("保存成功");
              this.searchFunc();
              this.addOrEdit = false;
            } else {
              return this.$message.warning(res.message);
            }
          });
        }
      });
    },
    //取消
    cancelTne() {
      this.addOrEdit = false;
    },
    //点击行选中
    authorizeFor(row) {
      if (this.$refs.multipleTable) {
        this.$refs.multipleTable.clearSelection();
      }
      this.$refs.multipleTable.toggleRowSelection(row, true);
    },
    // 选择模块
    moduleChange(val) {
      if (val) {
        this.getFundQueryList({ moduleCode: val });
      } else {
        this.fTTQueryList = [];
      }
      this.saveForm.tableType = "";
      this.saveForm.tableNameEnPrefix = "";
    },
    // 选择模板
    tableTypeChange(val) {
      if (val) {
        let data =
          this.$getLabel(val, this.fTTQueryList, "tableCode", "tableNameEn") +
          "_";
        this.saveForm.tableNameEnPrefix = data;
      } else {
        this.saveForm.tableNameEnPrefix = "";
      }
    },
    //分页
    handleSizeChange(val) {
      this.searchForm.size = val;
      this.searchFunc();
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.searchForm.page = val;
      this.searchFunc();
      console.log(`当前页: ${val}`);
    },
    searchFunc() {
      publicManage_dat.fundToolTableQuery(this.searchForm).then(res => {
        if (res.code === 200) {
          this.tableData = res.datas.rows;
          this.total = res.datas.total;
        } else {
          this.$message.error(res.message);
        }
      });
    },
    //   查看模板    ##########################################################################################################################################
    seeTemplateBtn() {
      if (this.saveForm.tableType) {
        let v = this.fTTQueryList.filter(item => {
          return item.tableCode == this.saveForm.tableType;
        });
        this.requiredParameter = v[0].tableId;
        this.seeTemplate = true;
        this.$nextTick(() => {
          this.$refs.FieldInformationCom.saveForm.columnEn = "";
          this.$refs.FieldInformationCom.saveForm.columnCn = "";
          this.$refs.FieldInformationCom.saveForm.columnType = "";
          this.$refs.FieldInformationCom.searchFunc();
        });
      } else {
        this.$message.warning("请选择数据模板");
      }
    },
    //日期数据处理
    setCalendarDate(val) {
      return moment(val).format("YYYY-MM-DD hh:mm:ss");
    },
    statusFormatter(val) {
      let str = "";
      switch (val.status) {
        case "1":
          str = "未发布";
          break;
        case "2":
          str = "已发布";
          break;
        case "3":
          str = "已停用";
          break;
        default:
          break;
      }
      return str;
    },
    validatorFTTCheckTableNameEn(rule, value, callback) {
      const data = this.saveForm.tableNameEnPrefix + this.saveForm.tableNameEn;
      if(this.saveFlg!=1){
        //   只在新增时校验
            callback();
            return;
      }
      //金融工具表保存-验证英文名是否重复
      publicManage_dat
        .fTTCheckTableNameEn({
          isModule: "0",
          tableNameEn: data
        })
        .then(res => {
          if (!res.data) {
            callback();
          } else {
            callback(new Error("英文名重复"));
          }
        });
    },
    validatorFTTCheckTableNameCn(rule, value, callback) {
      //金融工具表保存-验证中文名/模板名是否重复
       if(this.saveFlg!=1){
        //   只在新增时校验
            callback();
            return;
      }
      publicManage_dat
        .fTTCheckTableNameCn({
          isModule: "0",
          tableNameCn: this.saveForm.tableNameCn
        })
        .then(res => {
          if (!res.data) {
            callback();
          } else {
            callback(new Error("中文名重复"));
          }
        });
    }
  }
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog__body {
  max-height: none;
}
</style>